var __extends =
    (this && this.__extends) ||
    (function () {
      var i = function (e, o) {
        return (i =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (i, e) {
              i.__proto__ = e;
            }) ||
          function (i, e) {
            for (var o in e)
              Object.prototype.hasOwnProperty.call(e, o) && (i[o] = e[o]);
          })(e, o);
      };
      return function (e, o) {
        function s() {
          this.constructor = e;
        }
        if ("function" != typeof o && null !== o)
          throw new TypeError(
            "Class extends value " + String(o) + " is not a constructor or null"
          );
        i(e, o),
          (e.prototype =
            null === o
              ? Object.create(o)
              : ((s.prototype = o.prototype), new s()));
      };
    })(),
  AXWearKuangShiDialog = (function (i) {
    function e() {
      var e = i.call(this) || this;
      return (
        (e.isCurrentPage = !1),
        (e.onLoadBaoShiDiuQiActionDataFn = {
          caller: e,
          code: 1091,
          method: function (i) {
            0 != i.code
              ? ToastView.toastView(i.msg)
              : ToastView.toastView(i.data),
              e.close();
          },
        }),
        (e.onLoadKuangShiShiyongData = {
          caller: e,
          code: 2032,
          method: function (i) {
            0 != i.code
              ? ToastView.toastView(i.msg)
              : (ToastView.toastView(i.data),
                WebSocketService.send({ c: 6008, d: { pageNum: 0 } })),
              e.close();
          },
        }),
        (e.onLoadKuangShiDiuQiData = {
          caller: e,
          code: 1068,
          method: function (i) {
            0 != i.code
              ? ToastView.toastView(i.msg)
              : (ToastView.toastView(i.msg),
                "药品" == e.types &&
                  WebSocketService.send({ c: 1416, d: { pageNum: 0 } })),
              e.close();
          },
        }),
        (e.onLoadKuangshiDetaileFn = {
          caller: e,
          code: 1064,
          method: function (i) {
            0 != i.code
              ? ToastView.toastView(i.msg)
              : (e.lbl_kuangshiContent.text =
                  i.data.describe +
                  "\n" +
                  i.data.effect +
                  "\n 等级：" +
                  i.data.lvl +
                  "\n 锁定状态：" +
                  i.data.lock +
                  "\n 效果值：" +
                  i.data.value);
          },
        }),
        (e.onLoadBaoShiDetaileFn = {
          caller: e,
          code: 1060,
          method: function (i) {
            if (0 != i.code) ToastView.toastView(i.msg);
            else {
              for (var o = i.data, s = "", n = 0; n < o.length; n++)
                if ("等级:" != o[n].k || "--" != o[n].v) {
                  s = s + o[n].k + o[n].v + "\n";
                }
              e.lbl_kuangshiContent.text = s;
            }
          },
        }),
        WebSocketService.addListener(e.onLoadKuangshiDetaileFn),
        WebSocketService.addListener(e.onLoadBaoShiDetaileFn),
        e.btn_kuangShiSure.on(Laya.Event.CLICK, e, e.onDidKuangShiSureClickFn),
        e.btn_kuangshiViewCancle.on(
          Laya.Event.CLICK,
          e,
          e.onDidKuangshiDiuQiClickFn
        ),
        WebSocketService.addListener({
          caller: e,
          code: 6067,
          method: e.onLoadUserDataFn,
        }),
        WebSocketService.addListener(e.onLoadKuangShiShiyongData),
        WebSocketService.addListener(e.onLoadKuangShiDiuQiData),
        e
      );
    }
    return (
      __extends(e, i),
      (e.showKuangShiDialog = function (i, o, s) {
        null == this.kuangshiView &&
          ((this.kuangshiView = new e()), (this.kuangshiView.zOrder = 1e3)),
          this.kuangshiView.popup(!0),
          (this.kuangshiView.wearListArr = []),
          (this.kuangshiView.types = o),
          (this.kuangshiView.jsonObj = i),
          (this.kuangshiView.btn_kuangShiSure.visible = !0),
          (this.kuangshiView.lbl_kuangshiName.text = i.name),
          (78 !== i.id &&
            79 != i.id &&
            80 != i.id &&
            81 != i.id &&
            157 != i.id &&
            158 != i.id &&
            159 != i.id) ||
            (this.kuangshiView.btn_kuangShiSure.visible = !1),
          242 == i.id || 243 == i.id || 244 == i.id || 245 == i.id
            ? (this.kuangshiView.height = 280)
            : (this.kuangshiView.height = 250),
          void 0 != o &&
            ("镶嵌" == o
              ? ((this.kuangshiView.btn_kuangShiSure.label = o),
                WebSocketService.send({ c: 1064, d: { id: i.id } }))
              : "矿石" == o || "药品" == o || "杂物" == o || "使用" == o
              ? WebSocketService.send({ c: 1060, d: { gid: i.id } })
              : WebSocketService.send({ c: 1064, d: { id: i.id } })),
          "visiable_true" == s
            ? ((this.kuangshiView.btn_kuangShiSure.visible = !1),
              (this.kuangshiView.btn_kuangshiViewCancle.visible = !1))
            : ((this.kuangshiView.btn_kuangShiSure.visible = !0),
              (this.kuangshiView.btn_kuangshiViewCancle.visible = !0)),
          (78 !== i.id &&
            79 != i.id &&
            80 != i.id &&
            81 != i.id &&
            157 != i.id &&
            158 != i.id &&
            159 != i.id) ||
            (this.kuangshiView.btn_kuangShiSure.visible = !1);
      }),
      (e.prototype.onDidKuangShiSureClickFn = function (i) {
        if (void 0 != this.types)
          if ("镶嵌" == this.types)
            this.close(), AXMagicInlayDialog.showInsertBaoShiView(this.jsonObj);
          else if ("药品" == this.types)
            AXSupplementPhysicalView.showPhysicalView(this.jsonObj);
          else {
            var e = this.jsonObj;
            if (
              78 == e.id ||
              79 == e.id ||
              80 == e.id ||
              81 == e.id ||
              157 == e.id ||
              158 == e.id ||
              159 == e.id
            )
              return;
            if ("421" == this.jsonObj.id) {
              var o = {
                id: this.jsonObj.id,
                type: "魂元丹",
                num: this.jsonObj.num,
              };
              UseHunDanDialog.showUseHunView(o);
            } else if (408 == e.id)
              WearableUsedDialog.showWearableShow(e.id, e.num);
            else if ("409" == this.jsonObj.id)
              WearableUsedDialog.showWearableShow(
                this.jsonObj.id,
                this.jsonObj.num
              );
            else if (
              "242" == this.jsonObj.id ||
              "243" == this.jsonObj.id ||
              "244" == this.jsonObj.id ||
              "245" == this.jsonObj.id
            )
              WearableUsedDialog.showWearableShow(
                this.jsonObj.id,
                this.jsonObj.num
              );
            else if ("425" == this.jsonObj.id)
              WearableUsedDialog.showWearableShow(
                this.jsonObj.id,
                this.jsonObj.num
              );
            else if ("426" == this.jsonObj.id)
              NormalDialog.showNormalDialog(
                "您确定使用招贤榜吗",
                this,
                this.onQueDingZhaoXianBangFn
              );
            else if ("85" == this.jsonObj.id)
              this.close(), AXChangeNewNameDialog.showChangeNameDialog();
            else if (73 == this.jsonObj.id)
              WebSocketService.send({ c: 1074, d: { gid: 73 } });
            else if (74 == e.id) WebSocketService.send({ c: 1073, d: null });
            else if (75 == e.id) AXWorshipDialog.showWorshipDialog("");
            else if (
              68 == this.jsonObj.id ||
              69 == this.jsonObj.id ||
              381 == this.jsonObj.id
            )
              this.close(),
                AXRecruitmentDialog.showRecruitmentOpen(
                  "1",
                  "AXWearableGoodView"
                );
            else if (396 == this.jsonObj.id) WebSocketService.send({ c: 6067 });
            else if (108 == this.jsonObj.id || 109 == this.jsonObj.id)
              WebSocketService.send({ c: 1082, d: { gid: this.jsonObj.id } });
            else if (this.jsonObj.id > 500 && this.jsonObj.id < 509)
              WebSocketService.send({ c: 1904, d: { gid: this.jsonObj.id } });
            else if (271 == e.id || 400 == e.id || 434 == e.id)
              WebSocketService.send({ c: 1085, d: { gid: e.id } });
            else if (651 == e.id)
              AXMaterialDialog.showMateralView(e, "手里剑", e.num);
            else if (
              parseInt(this.jsonObj.id) >= 601 &&
              parseInt(this.jsonObj.id) <= 700
            ) {
              if (653 == this.jsonObj.id)
                return void NormalDialog.showNormalDialog(
                  "确定使用一个签到令牌？",
                  this,
                  this.onDailySignFn
                );
              if (654 == this.jsonObj.id)
                return void NormalDialog.showNormalDialog(
                  "确定使用一个幸运转盘红包?",
                  this,
                  this.onUseHongBaoFn
                );
              if (655 == this.jsonObj.id)
                return void NormalDialog.showNormalDialog(
                  "确定使用壕客令牌?",
                  this,
                  this.onUseHaoKeFn
                );
              if (656 == this.jsonObj.id)
                return void NormalDialog.showNormalDialog(
                  "确定使用超级壕客令牌?",
                  this,
                  this.onUseSuperHaoKeFn
                );
              this.jsonObj.num >= 10
                ? NormalDialog.showNormalDialog(
                    "您是否消耗10个虎符召唤一个国士？",
                    this,
                    this.onZhaoHuanHuFuFn
                  )
                : (this.close(), ToastView.toastView("虎符数量不足10个"));
            } else
              "82" == this.jsonObj.id
                ? (this.close(),
                  WebSocketService.send({
                    c: 1075,
                    d: { gid: this.jsonObj.id },
                  }))
                : "71" == this.jsonObj.id || "72" == this.jsonObj.id
                ? AXSendGiftDialog.showSendGiftDialog(this.jsonObj)
                : 252 == this.jsonObj.id ||
                  253 == this.jsonObj.id ||
                  254 == this.jsonObj.id ||
                  255 == this.jsonObj.id ||
                  256 == this.jsonObj.id
                ? AXMaterialDialog.showMateralView(
                    this.jsonObj,
                    this.jsonObj.name,
                    this.jsonObj.num,
                    !0
                  )
                : this.jsonObj.id >= 302 && this.jsonObj.id <= 306
                ? WearableUsedDialog.showWearableShow(
                    this.jsonObj.id,
                    this.jsonObj.num
                  )
                : 147 == this.jsonObj.id ||
                  148 == this.jsonObj.id ||
                  149 == this.jsonObj.id ||
                  425 == this.jsonObj.id
                ? WearableUsedDialog.showWearableShow(
                    this.jsonObj.id,
                    this.jsonObj.num
                  )
                : "83" == this.jsonObj.id || "84" == this.jsonObj.id
                ? WearableUsedDialog.showWearableShow(
                    this.jsonObj.id,
                    this.jsonObj.num
                  )
                : 87 == this.jsonObj.id ||
                  88 == this.jsonObj.id ||
                  89 == this.jsonObj.id
                ? WebSocketService.send({
                    c: 1076,
                    d: { gid: this.jsonObj.id },
                  })
                : 123 == this.jsonObj.id
                ? AXCommonConfirmDialog.showConfirmDialog(
                    "",
                    this.jsonObj.name,
                    "您确定要进入游乐场进行使用吗？",
                    "确定",
                    "取消"
                  )
                : 131 == this.jsonObj.id ||
                  132 == this.jsonObj.id ||
                  133 == this.jsonObj.id ||
                  134 == this.jsonObj.id ||
                  135 == this.jsonObj.id
                ? WearableUsedDialog.showWearableShow(
                    this.jsonObj.id,
                    this.jsonObj.num
                  )
                : 427 == this.jsonObj.id
                ? WebSocketService.send({
                    c: 6413,
                    d: { gid: this.jsonObj.id },
                  })
                : 440 == this.jsonObj.id ||
                  284 == this.jsonObj.id ||
                  285 == this.jsonObj.id ||
                  286 == this.jsonObj.id ||
                  441 == this.jsonObj.id
                ? AXMaterialDialog.showMateralView(
                    this.jsonObj,
                    this.jsonObj.name,
                    this.jsonObj.num,
                    !0
                  )
                : WebSocketService.send({
                    c: 2032,
                    d: { id: this.jsonObj.id },
                  });
          }
      }),
      (e.prototype.onDailySignFn = function () {
        WebSocketService.send({ c: 5310, d: { goodsId: 653, count: 1 } });
      }),
      (e.prototype.onUseHongBaoFn = function () {
        WebSocketService.send({ c: 5310, d: { goodsId: 654, count: 1 } });
      }),
      (e.prototype.onUseHaoKeFn = function () {
        WebSocketService.send({ c: 5310, d: { goodsId: 655, count: 1 } });
      }),
      (e.prototype.onUseSuperHaoKeFn = function () {
        WebSocketService.send({ c: 5310, d: { goodsId: 656, count: 1 } });
      }),
      (e.prototype.onZhaoHuanHuFuFn = function () {
        WebSocketService.send({ c: 1909, d: { gid: this.jsonObj.id } });
      }),
      (e.prototype.onQueDingZhaoXianBangFn = function () {
        WebSocketService.send({ c: 6414, d: { gid: 426 } });
      }),
      (e.prototype.onDidKuangshiDiuQiClickFn = function () {
        void 0 != this.types &&
          ("镶嵌" == this.types
            ? WebSocketService.send({ c: 1091, d: { id: this.jsonObj.id } })
            : "药品" == this.types
            ? NormalDialog.showNormalDialog(
                "您确定要删除" + this.jsonObj.name + "吗？",
                this,
                this.onSureDiuQiYaoPinAction
              )
            : "杂物" == this.types
            ? NormalDialog.showNormalDialog(
                "您确定要删除" + this.jsonObj.name + "吗？",
                this,
                this.onSureDiuQiAction
              )
            : "宝石" == this.types
            ? NormalDialog.showNormalDialog(
                "您确定要删除" + this.jsonObj.name + "吗？",
                this,
                this.onSureDiuQiBaoShiAction
              )
            : "矿石" == this.types
            ? NormalDialog.showNormalDialog(
                "您确定要删除" + this.jsonObj.name + "吗？",
                this,
                this.onSureDiuQiKuangShiAction
              )
            : WebSocketService.send({ c: 1068, d: { gid: this.jsonObj.id } }));
      }),
      (e.prototype.onSureDiuQiKuangShiAction = function () {
        WebSocketService.send({ c: 1068, d: { gid: this.jsonObj.id } }),
          WebSocketService.send({ c: 6008, d: { pageNum: 0 } });
      }),
      (e.prototype.onSureDiuQiBaoShiAction = function () {
        WebSocketService.send({ c: 1091, d: { id: this.jsonObj.id } }),
          WebSocketService.send({ c: 6034, d: { pageNum: 0 } });
      }),
      (e.prototype.onSureDiuQiYaoPinAction = function () {
        WebSocketService.send({ c: 1068, d: { gid: this.jsonObj.id } }),
          WebSocketService.send({ c: 1416, d: { pageNum: 0 } });
      }),
      (e.prototype.onSureDiuQiAction = function () {
        WebSocketService.send({ c: 1068, d: { gid: this.jsonObj.id } }),
          WebSocketService.send({ c: 1425, d: { pageNum: 0 } });
      }),
      (e.prototype.onLoadUserDataFn = function (i) {
        ToastView.toastView(i.msg),
          0 == i.code &&
            (WebSocketService.send({ c: 1425 }),
            (6067 != i.act_id && 1904 != i.act_id) ||
              (Laya.stage.event("GameMainView", "refreshMoney"),
              Laya.stage.event("HomePageView", "refreshMoney")),
            1085 == i.act_id &&
              (Laya.stage.event("GameMainView", "exp"),
              Laya.stage.event("HomePageView", "exp")),
            1082 == i.act_id && WebSocketService.send({ c: 1476 }));
      }),
      (e.close = function () {
        this.kuangshiView && this.kuangshiView.close();
      }),
      e
    );
  })(ui.TabBarItemController.AXWearKuangShiDialogUI);
